package com.dkd.easybook.service.impl;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dkd.easybook.domain.EbIcons;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dkd.easybook.mapper.EbAccountCategoryDefaultMapper;
import com.dkd.easybook.domain.EbAccountCategoryDefault;
import com.dkd.easybook.service.IEbAccountCategoryDefaultService;
/**
 * 系统默认记账类别Service业务层处理
 *
 * @author itheima
 * @date 2024-12-13
 */
@Service
public class EbAccountCategoryDefaultServiceImpl extends ServiceImpl<EbAccountCategoryDefaultMapper, EbAccountCategoryDefault> implements IEbAccountCategoryDefaultService {
    @Autowired
    private EbAccountCategoryDefaultMapper ebAccountCategoryDefaultMapper;
    @Autowired
    private EbIconsServiceImpl ebIconsServiceImpl;
    /**
     * 查询系统默认记账类别
     *
     * @param categoryId 系统默认记账类别主键
     * @return 系统默认记账类别
     */
    @Override
    public EbAccountCategoryDefault selectEbAccountCategoryDefaultByCategoryId(Long categoryId) {
        return ebAccountCategoryDefaultMapper.selectEbAccountCategoryDefaultByCategoryId(categoryId);
    }
    /**
     * 查询系统默认记账类别列表
     *
     * @param ebAccountCategoryDefault 系统默认记账类别
     * @return 系统默认记账类别
     */
    @Override
    public List<EbAccountCategoryDefault> selectEbAccountCategoryDefaultList(EbAccountCategoryDefault ebAccountCategoryDefault) {
        List<EbAccountCategoryDefault> ebAccountCategoryDefaultList = ebAccountCategoryDefaultMapper.selectEbAccountCategoryDefaultList(ebAccountCategoryDefault);
        for (EbAccountCategoryDefault _ebAccountCategoryDefault : ebAccountCategoryDefaultList) {
            EbIcons ebIcons = ebIconsServiceImpl.selectEbIconsByIconId(_ebAccountCategoryDefault.getIconId());
            if (ebIcons != null) {
                _ebAccountCategoryDefault.setIconUrl(ebIcons.getUrl());
            }
        }
        return ebAccountCategoryDefaultList;
    }
    /**
     * 新增系统默认记账类别
     *
     * @param ebAccountCategoryDefault 系统默认记账类别
     * @return 结果
     */
    @Override
    public int insertEbAccountCategoryDefault(EbAccountCategoryDefault ebAccountCategoryDefault) {
        return ebAccountCategoryDefaultMapper.insertEbAccountCategoryDefault(ebAccountCategoryDefault);
    }
    /**
     * 修改系统默认记账类别
     *
     * @param ebAccountCategoryDefault 系统默认记账类别
     * @return 结果
     */
    @Override
    public int updateEbAccountCategoryDefault(EbAccountCategoryDefault ebAccountCategoryDefault) {
        return ebAccountCategoryDefaultMapper.updateEbAccountCategoryDefault(ebAccountCategoryDefault);
    }
    /**
     * 批量删除系统默认记账类别
     *
     * @param categoryIds 需要删除的系统默认记账类别主键
     * @return 结果
     */
    @Override
    public int deleteEbAccountCategoryDefaultByCategoryIds(Long[] categoryIds) {
        return ebAccountCategoryDefaultMapper.deleteEbAccountCategoryDefaultByCategoryIds(categoryIds);
    }
    /**
     * 删除系统默认记账类别信息
     *
     * @param categoryId 系统默认记账类别主键
     * @return 结果
     */
    @Override
    public int deleteEbAccountCategoryDefaultByCategoryId(Long categoryId) {
        return ebAccountCategoryDefaultMapper.deleteEbAccountCategoryDefaultByCategoryId(categoryId);
    }
}
